<template>
    <div v-loading="loading">
        <div>
            <e-container>
                <el-carousel indicator-position="outside" height="420px">
                    <el-carousel-item v-for="item in bhtList" :key="item.id">
                        <div style="background-size: cover" @click="$goto(item.url)"
                             :style="{'background-image': 'url('+item.image+')',width:'100%', height: '600px'}"></div>
                    </el-carousel-item>
                </el-carousel>
            </e-container>
        </div>
        <div>
            <e-container>
                <el-row :gutter="15">
                    <el-col :md="12">
                        <div class="title-modelbox-widget1">
                            <h3 class="section-title">
                                <div class="more">
                                    <a href="">更多>></a>
                                </div>
                                学习资料
                            </h3>
                            <div class="sidebar-widget-body">
                                <div class="">
                                    <e-news-list
                                            v-for="r in xuexiziliaolist1"
                                            :key="r.id"
                                            :to="'/xuexiziliaodetail?id='+r.id"
                                            :title="r.ziliaomingcheng"
                                            :description="r.ziliaoneirong"
                                            :len="30"
                                            :image="r.ziliaotupian"
                                    >
                                        <span>资料类型: <e-select-view module="ziliaoleixing" :value="r.ziliaoleixing"
                                                                   select="id" show="leixingmingcheng"></e-select-view></span>
                                        <span>专业:{{ r.zhuanye }}</span>
                                        <span>资料附件:<e-file-list v-model="r.ziliaofujian"></e-file-list></span>
                                        <span>点击率:{{ r.dianjilv }}</span>
                                        <span>发布人:{{ r.faburen }}</span>
                                        <span>发布时间:{{ r.addtime }}</span>
                                    </e-news-list>
                                </div>
                            </div>
                            <!-- /.sidebar-widget-body -->
                        </div>
                    </el-col>
                    <el-col :md="12">
                        <div class="title-modelbox-widget1">
                            <h3 class="section-title">
                                <div class="more">
                                    <a href="">更多>></a>
                                </div>
                                公告信息
                            </h3>
                            <div class="sidebar-widget-body">
                                <div class="">
                                    <e-news-list
                                            v-for="r in gonggaolist2"
                                            :key="r.id"
                                            :to="'/gonggaodetail?id='+r.id"
                                            :title="r.gonggaobiaoti"
                                            :description="r.gonggaoneirong"
                                            :len="30"
                                            :image="r.gonggaotupian"
                                    >
                                        <span>发布人:{{ r.faburen }}</span>
                                        <span>发布时间:{{ r.addtime }}</span>
                                    </e-news-list>
                                </div>
                            </div>
                            <!-- /.sidebar-widget-body -->
                        </div>
                    </el-col>
                </el-row>
            </e-container>
        </div>
    </div>
</template>
<style type="text/scss" scoped lang="scss"></style>
<script>
    import api from "@/api";
    import {extend} from "@/utils/extend";
    import jdk from "@/utils/extend";

    export default {
        data() {//得到响应数据
            return {//将响应数据渲染
                loading: false,
                bhtList: [],
                xuexiziliaolist1: [],
                gonggaolist2: [],
            };
        },
        watch: {},
        computed: {},
        methods: {
            loadPageData() {
                if (this.loading) return;
                this.loading = true;
                this.$get("/index")//向后端发起请求
                    .then((res) => {
                        this.loading = false;
                        if (res.code == api.code.OK) {
                            extend(this, res.data);
                        } else {
                            this.$message.error(res.msg);
                        }
                    })
                    .catch((err) => {
                        this.loading = false;
                        this.$message.error(err.message);
                    });
            },
        },
        created() {
            this.loadPageData();
        },
        mounted() {
        },
        destroyed() {
        },
    };
</script>
